
package matchingPLS2TF;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import pack1.PLS;


public class Main2FlickrData3_2 {

	
	public static void main (String [] args) throws Exception{
		//continene tutti gli utenti  
		List<PLS> pls = new ArrayList<PLS>();
		FlickrUserMethods.loadPLSUser(pls, "C:\\Users\\Alket\\codeindigo\\DataTel\\4plsusers.txt");
		
		Collections.sort(pls);
		
		
		
	    Map<String, List<PLS>>	data = new HashMap<String, List<PLS>>();
	    Set<String> excluded = new HashSet<String>();
	    
	    
		List<PLSUser> pls_user ;
		
		for (int i = 0; i < pls.size(); i++) {	
		
			//pls_user = new ArrayList<PLSUser>();
			if((pls.size() -(i+1))==0){
				break;
			}
			String username_i1 = pls.get(i+1).h;
			String username_i = pls.get(i).h;
			
			System.out.println(username_i);
			
				double fl_lat = pls.get(i).lat;
				double fl_lon = pls.get(i).lon;
				
				System.out.println("***********"+fl_lat+", "+fl_lon);
				long ts_pls_user = pls.get(i).time;
				pls_user = new ArrayList<PLSUser>();
				System.out.println("****** "+pls.get(i).h+" ha timestamp = "+ts_pls_user);
				Object[] o = FlickrUserMethods2.ts_pls_list4FlickrUser("C:/DATA/data/mese/AllData",
						fl_lat, fl_lon, ts_pls_user);
				
				//pls_user = (List<PLS>)o[0];
				//data.put(pls.get(i).h, pls_user);
				
				excluded.addAll((Set<String>)o[1]);
				
				
				
				if(!(username_i.equals(username_i1))){
					//FlickrUserMethods.print("Twitter2PLSResults_"+username_i+", "+i+"_10min.txt", data);
					System.out.println("stampo file per "+username_i);
					FlickrUserMethods.print("Twitter2PLSExcluded_"+username_i+", "+i+"_10min.txt", excluded);
					System.out.println("stampo file esclusione per "+username_i);
					
					// cancello per prepararmi al prossimo utente
					data = new HashMap<String, List<PLS>>();
					excluded = new HashSet<String>();
				}
			}
				
	    
	    
    }
}
